package Exer04_循环;
import java.util.Scanner;
public class _1_4_5_判断是否为完数 {
        public static void main(String[] args) {
            Scanner scanner = new Scanner(System.in);
            System.out.println("输入一个数，判断是否为完数:");
            int num = scanner.nextInt();
            int num1 = 0;
            for (int i = 1; i < num; i++) {
                if (num % i == 0){
                    num1 += i;
                }
            }
            if (num == num1){
                System.out.println("是完数");
            }else {
                System.out.println("不是完数");
            }
            scanner.close();
        }
}
